function headShow()
{
    var dic={"flag":"getToolCls","count":5}
    ajax(dic,"center.php","POST",js=true,function(e)
    {
        var dic=JSON.parse(e)
        // var dic=e
        var insert=""
        var addClass=document.getElementById("addClass")
        for(i in dic)
        {
        	cls=dic[i]["cls"]
        	insert+="<button onclick=toIndexShow('"+cls+"',this)>"+cls+"</button>"
        }
        addClass.innerHTML=insert

    })
}

// ajax函数
function ajax(dic,url,method,js=true,fun="")
{
	var xhr=new XMLHttpRequest()
	xhr.open(method,url,true)

	 
	 xhr.onreadystatechange = function(e)
	
	{
		
		if(xhr.readyState == 4&&xhr.status==200)
		{
			console.log(xhr.response)
			if(fun!="")
			{
				fun(xhr.response)
			}
		}
	}

	if(js)
	{
		xhr.setRequestHeader('Content-Type', 'application/json; charset=UTF-8');
		xhr.send(JSON.stringify(dic))
		
	}
	else
	{
		uploadPercent=0
		xhr.upload.addEventListener("progress",function(e)
		{
			uploadPercent=(e.loaded/e.total)*100
			showStatus("已经上传:"+uploadPercent+"%")
		})
		xhr.send(dic)
	}
}